package com.athenaeum.dataxplore.controller;

import java.util.Locale;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class IndexController {

	private static final Logger log = LoggerFactory
			.getLogger(IndexController.class);

	/**
	 * Simply selects the home view to render by returning its name.
	 */
	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String index(Locale locale, Model model) {
		log.info("Welcome home! The client locale is {}.", locale);
		return "index";
	}

	@RequestMapping(value = "/getUsers", method = RequestMethod.GET)
	public @ResponseBody
	String usersData(Locale locale, Model model) {
		return "{\"success\": true,\"users\": [{\"id\": 1, \"name\": 'Ed', \"email\": \"ed@sencha.com\"},{\"id\": 2, \"name\": 'Tommy', \"email\": \"tommy@sencha.com\"}]}";
	}

}
